import React from 'react'
import { Row, Col, Icon, Menu, Dropdown } from 'antd'
import {connect} from 'react-redux';
import classNames from 'classnames'//引入classnames依赖库

import './index.less'
import { Link } from 'react-router'
import UserBox from './UserBox';

class Header extends React.Component {
    constructor() {
        super();
    }
    render() {
        let custumMenus = this.props.app.config.menus.topNav;
        return (
            <div className="header">
                <div className="topnav">
                    <h1><a href="#" className="logo">云</a></h1>
                    <div className="top-panel">
                        <ul className="top-menu custom-menu nav-menu-list">
                            {
                                custumMenus.map((item,i)=>{
                                    let className = classNames("custom-item",{
                                        cur: false
                                    })
                                    return (
                                        <li key={i} className={className}>
                                            <a href={`#${item.link}`}>{item.title}</a>
                                        </li>
                                    )
                                })
                            }
                        </ul>
                        <ul className="top-menu user-menu">
                            <UserBox />
                            <li>
                                <a href="/swagger/" target="_blank">
                                    <span>文档</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        )
    }
}
export default connect(
    state => {
        return {
            app:state.app
        }
    },
    dispatch => {
        return {
        }
    }
)(Header);
